<!-- 查询 content 列表 -->
{{ $contentSQL :="status in (1,2) and scode=?" }}
{{ $categorySQL := "id=? and status<3" }}


{{ if eq .userType 1}}
  {{ $contentSQL ="* FROM ay_content WHERE categoryID=? order by sorting desc" }}
  {{ $categorySQL = "* FROM ay_content_sort WHERE id=? order by sorting desc"}}
{{end}}

{{ $selectList := selectList "ay_content" .q .pageNo 20 $contentSQL .UrlPathParam }}

{{ $nav := selectOne "ay_content_sort" $categorySQL .UrlPathParam }}
{{ $site:=site }}
<!DOCTYPE html>
<html lang="zh-cn">
<head>
  <title>{{ $nav.name }}</title>
  <meta name="description" content="{{ $nav.description }}" />
  <meta name="keyword" content="{{ $nav.keywords }}" />

{{template "bodystart.html"  }}

<section id="archive" class="archive">
  <div class="archive-title category">
        <h2 class="archive-name">{{$nav.name}}</h2>
  </div>
  {{ range $k,$v := $selectList.Data }}
  <div class="archive-post">
      <span class="archive-post-time">
        {{ .update_time }}
      </span>
      <span class="archive-post-title">
        {{ if eq $.userType 1}}
        <a href="{{basePath}}admin/content/look?id={{.id}}" class="archive-post-link">
        {{else}}
        <a href="{{basePath}}content/{{ trimSlash $v.id }}" class="archive-post-link">
        {{ end }}

          {{ .title }}
        </a>
      </span>
  </div>
  {{end}}


</section>

{{if gt $selectList.Page.PageCount 1}}
<nav class="pagination">
  {{$currPageNo := $selectList.Page.PageNo}}
  {{if lt $currPageNo 1}}
    {{$currPageNo = 1}}
  {{end}}
  {{if gt $currPageNo $selectList.Page.PageCount }}
     {{$currPageNo = $selectList.Page.PageCount}}
  {{end}}

  {{if gt $currPageNo 1}}
  <a class="prev" href="{{basePath}}{{ trimSlash $nav.Id }}/page/{{ addInt $currPageNo -1 }}?q={{.q}}">
      <i class="iconfont icon-left"></i>
      <span class="prev-text">上一页</span>
    </a>
  {{end}}
  {{if lt $currPageNo $selectList.Page.PageCount}}
  <a class="next" href="{{basePath}}{{ trimSlash $nav.Id }}/page/{{ addInt $currPageNo 1 }}?q={{.q}}">
      <span class="next-text">下一页</span>
      <i class="iconfont icon-right"></i>
    </a>
    {{end}}
</nav>
{{end}}

  {{template "bodyend.html" }}